import sys

from jqdatasdk import get_query_count, auth

from PyQt5.QtWidgets import QMainWindow, QApplication, QDialog
from ui2py.main_window import Ui_MainWindow
from ui2py.index_stock import Ui_StockIndex


def login(id, pwd):
    try:
        auth(id, pwd)
    except Exception as err:
        raise err


class IndexStock(QDialog, Ui_StockIndex):
    def __init__(self, parent):
        super().__init__(parent)
        self.setupUi(self)


class Main(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.actionList_Index.triggered.connect(self.show_index_stock)

    def show_index_stock(self):
        win_index_stock = IndexStock(self)
        win_index_stock.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    main_win = Main()
    main_win.show()
    sys.exit(app.exec_())

